package br.com.ads.sgse.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import br.com.ads.sgse.converter.BaseEntity;

@Entity
@Table(name="unidade_federacao")
public class UnidadeFederacao implements Serializable, BaseEntity{
	
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="unif_codigo")
	private Long codigo;
	
	@Column(name="unif_sigla")
	private String sigla;
	
	@Column(name="unif_nome")
	private String nome;
	
	

	public Long getCodigo() {return codigo;}
	public void setCodigo(Long codigo) {this.codigo = codigo;}

	public String getSigla() {return sigla;}
	public void setSigla(String sigla) {this.sigla = sigla;}

	public String getNome() {return nome;}
	public void setNome(String nome) {this.nome = nome;}

	
	
	@Override
	public Long getId() {return codigo;}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((codigo == null) ? 0 : codigo.hashCode());
		result = prime * result + ((nome == null) ? 0 : nome.hashCode());
		result = prime * result + ((sigla == null) ? 0 : sigla.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		UnidadeFederacao other = (UnidadeFederacao) obj;
		if (codigo == null) {
			if (other.codigo != null)
				return false;
		} else if (!codigo.equals(other.codigo))
			return false;
		if (nome == null) {
			if (other.nome != null)
				return false;
		} else if (!nome.equals(other.nome))
			return false;
		if (sigla == null) {
			if (other.sigla != null)
				return false;
		} else if (!sigla.equals(other.sigla))
			return false;
		return true;
	}
	
	
}
